<?php

/**
 * Caja filter form.
 *
 * @package    tercermilenio
 * @subpackage filter
 * @author     Your name here
 */
class CajaFormFilter extends BaseCajaFormFilter {

    public function configure() {
$this->widgetSchema['created_at']->addOption('template', 'Desde %from_date%<br/>Hasta %to_date%');
    }

    public function setup() {
        parent::setup();
        $this->setWidgets(array(
            //'cja_monto' => new sfWidgetFormFilterInput(),
            //'cja_op' => new sfWidgetFormFilterInput(),
            //'created_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
            'created_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormJQueryDate(array('format' => '%day%/%month%/%year%')), 'to_date' => new sfWidgetFormJQueryDate(array('format' => '%day%/%month%/%year%')),'with_empty'=> false)),
        ));

        $this->setValidators(array(
            //'cja_monto' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
            //'cja_op' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
            'created_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
        ));

        $this->widgetSchema->setNameFormat('caja_filters[%s]');

        $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
    }

}
